﻿// Copyright (c) 2007-2021 西安交通信息投资营运有限公司 版权所有
// 作者:吕艳阳

using Newtonsoft.Json;
using XCI.Helper;

namespace XCI.Core
{
    /// <summary>
    /// 区域信息
    /// </summary>
    public class AreaModel
    {
        private string _spell;

        /// <summary>
        /// 标识
        /// </summary>
        [JsonProperty("id")]
        public string Id { get; set; }

        /// <summary>
        /// 上级标识
        /// </summary>
        public string ParentId { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        [JsonProperty("name")]
        public string Name { get; set; }

        /// <summary>
        /// 类型：1.Province 2.City 3.County 4.Town
        /// </summary>
        public int Type { get; set; }

        /// <summary>
        /// 简拼
        /// </summary>
        public string Spell => _spell ?? (_spell = SpellHelper.GetSpell(Name));
    }

    /// <summary>
    /// 区域控件值
    /// </summary>
    public class AreaValue
    {
        /// <summary>
        /// 省
        /// </summary>
        public AreaModel Province { get; set; }

        /// <summary>
        /// 市
        /// </summary>
        public AreaModel City { get; set; }

        /// <summary>
        /// 区
        /// </summary>
        public AreaModel County { get; set; }

        /// <summary>
        /// 街道
        /// </summary>
        public AreaModel Town { get; set; }
    }

    public class DataObjectField
    {
        /// <summary>
        /// 省份标识字段
        /// </summary>
        public string ProvinceIdField { get; set; }

        /// <summary>
        /// 省份名称字段
        /// </summary>
        public string ProvinceNameField { get; set; }

        /// <summary>
        /// 城市标识字段
        /// </summary>
        public string CityIdField { get; set; }

        /// <summary>
        /// 城市名称字段
        /// </summary>
        public string CityNameField { get; set; }

        /// <summary>
        /// 区县标识字段
        /// </summary>
        public string CountyIdField { get; set; }

        /// <summary>
        /// 区县名称字段
        /// </summary>
        public string CountyNameField { get; set; }

        /// <summary>
        /// 街道标识字段
        /// </summary>
        public string TownIdField { get; set; }

        /// <summary>
        /// 街道名称字段
        /// </summary>
        public string TownNameField { get; set; }
    }
}